package com.example.qihuibao.module.presentation

import android.app.Presentation
import android.content.Context
import android.hardware.display.DisplayManager
import android.os.Bundle
import android.view.Display
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.example.qihuibao.XApplication

/**
 *@author: cww
 *@desc:
 *@date: 2023/11/16 16:43
 */
class MyPresentation(ctx:Context, display:Display, private val root: View) : Presentation(ctx, display) {
    companion object {
        fun getDisplay():Display? {
            val displays = (XApplication.application.getSystemService(AppCompatActivity.DISPLAY_SERVICE) as DisplayManager).getDisplays(
                DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
            for (display in displays) {
                if (display.displayId != Display.DEFAULT_DISPLAY) {
                    return display
                }
            }
            return null
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(root)
    }
}